package com.tang.factory;

import com.tang.entity.Activity;

import java.util.Date;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

/**
 * 商品享元工厂
 *
 * @author fulin.tang
 * @version V3.0
 * @since 2021/9/13 17:49
 */
public class ActivityFactory {

    private static final Map<Long, Activity> activityMap = new ConcurrentHashMap<>();

    public static Activity getActivity(Long id) {
        Activity activity = activityMap.get(id);
        if (null == activity) {
            activity = Activity.builder()
                    .id(1000L)
                    .name("你瞅啥！")
                    .desc("瞅你咋地！")
                    .startTime(new Date())
                    .stopTime(new Date())
                    .build();
            activityMap.put(id, activity);
        }
        return activity;
    }

}
